/**
 * @description 输出最长的连续序列，不要求在原数组中顺序排列
 * @param {number[]} nums
 * @return {number}
 */
var longestConsecutive = function (nums) {
    if (nums.length === 0 || nums.length === 1) return nums.length;
    let temp = nums.sort((a, b) => a - b);
    let result = [temp[0]];
    let max = 1;
    for (let i = 1; i < nums.length; i++) {
        if (result[result.length - 1] === temp[i])
            continue;
        if (result[result.length - 1] + 1 === temp[i])
            result.push(temp[i]);
        else
            result = [temp[i]];
        if (max < result.length)
            max = result.length;
    }
    return max;
};
console.log(longestConsecutive([0, 0]))